﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/ViewPageAdmin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PegasCompany.AdminPanel.Default" %>

<%@ Import Namespace="PegasCompany.Helper" %>
<%@ Import Namespace="PegasCompany.Tools" %>


<asp:Content ID="Content3" ContentPlaceHolderID="cphTitle" runat="server">
    Панель управления
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphTitleDescription" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="server">
    <asp:MultiView runat="server" ID="mvContentEditor">
        <asp:View runat="server" ID="vContentList">
        </asp:View>
        <asp:View runat="server" ID="vEditForm">
            <div class="fieldGrid">
                <h1>Правка</h1>
                <div class="fieldEntry">
                    <h1>Заголовок [до 150 символов]</h1>
                    <div class="fieldEntryControl">
                        <asp:TextBox runat="server" ID="txtTitle" MaxLength="150" />
                    </div>
                </div>
                <div class="fieldEntry">
                    <h1>Описание [до 200 символов]</h1>
                    <div class="fieldEntryControl">
                        <asp:TextBox runat="server" ID="txtDescription" MaxLength="200" />
                    </div>
                </div>
                <div class="fieldEntry">
                    <h1>Текст</h1>
                    <div class="fieldEntryControl">
                        <ck:CKEditorControl runat="server" ID="ckContent" BasePath="~/ckeditor" Height="300" />
                    </div>
                </div>
                <div class="fieldEntry">
                    <h1>Фото
                    </h1>
                    <div class="fieldEntryControl">
                        <asp:FileUpload runat="server" ID="fuPhoto" />
                    </div>
                    <div class="fieldEntryControl">
                        <asp:Image runat="server" ID="iPhoto" />
                    </div>
                </div>
                <div class="fieldEntry">
                            <h1>Прикреплённые файлы</h1>
                            <div class="fieldEntryControl">
                                <asp:FileUpload runat="server" ID="fuAttachFile" />
                                <asp:Button runat="server" ID="btnSaveAttach" Text="Загрузить файл" OnClick="btnSaveAttach_Click" />
                            </div>
                            <asp:UpdatePanel runat="server">
                                <ContentTemplate>
                                    <div class="fieldEntryControl">
                                        <div class="adminTableContainer">
                                            <div class="adminTableBlock">
                                                <asp:Repeater runat="server" ID="rptContentAttach" OnItemCommand="rptContentAttach_ItemCommand">
                                                    <HeaderTemplate>
                                                        <table style="width: 100%;">
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td>Имя файла</td>
                                                            <td colspan="2">
                                                                <asp:LinkButton runat="server" ID="btnOpenDocument" Text='<%# Eval("DocumentName") %>'
                                                                    CommandName="OpenAttach" CommandArgument='<%# Eval("AttachId") %>' /></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Путь к файлу</td>
                                                            <td colspan="2">
                                                                <asp:TextBox runat="server" ID="txtFilePath" Text='<%# String.Format("{0}{1}{2}", Request.Url.GetLeftPart(UriPartial.Authority),ConfigReader.SiteContentAttachmentPath, Eval("DocumentName")) %>' /></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Отображать в списке файлов</td>
                                                            <td>
                                                                <asp:CheckBox runat="server" ID="cbVisible" Checked='<%# Eval("IsVisible") %>' /></td>
                                                            <td>
                                                                <div class="adminTableRowIconBlock" style="float: right;">
                                                                    <div class="adminTableRowIcon">
                                                                        <asp:LinkButton ID="btnDeleteAttach" runat="server" ToolTip='<%$ Resources:UserSite, resDelete %>'
                                                                            CommandName="DeleteAttach" CommandArgument='<%# Eval("AttachId") %>' OnClientClick="return confirm('Подтвердите удаление')"
                                                                            CssClass="adminTableRowDelete" />
                                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>Свойства файла</td>
                                                            <td colspan="2">
                                                                <asp:Label ID="lDocumentType" runat="server" Text='<%# String.Format("{0} / {1}", Eval("DocumentType"), PageHelper.GetRoundedFileSize(Eval("DocumentSize"))) %>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3">
                                                                <hr />
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        </table>
                                                    </FooterTemplate>
                                                </asp:Repeater>
                                            </div>
                                        </div>
                                        <div style="clear: both;">
                                        </div>
                                    </div>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
            </div>
            
            <div style="overflow: hidden; text-align: right; padding: 20px 15px 0 0">
                <asp:Button runat="server" ID="btnSave" Text="Сохранить" OnClick="BtnSaveClick" />
            </div>
        </asp:View>
        <asp:View runat="server" ID="vListEditForm">
            <div style="overflow: hidden; display: block; margin-bottom: 16px;">
                <asp:Button runat="server" ID="btnAddListItem" OnClick="btnAddListItem_Click" Text="Добавить" />
            </div>
            <asp:Repeater runat="server" ID="rptList" OnItemCommand="rptList_ItemCommand">
                <HeaderTemplate>
                    <asp:Literal runat="server" ID="lOpenDiv" Text="<div>" />
                </HeaderTemplate>
                <ItemTemplate>
                    <div style="overflow: hidden; width: 100%;">
                        <div style="float: left; width: 140px;">
                            <%# Eval("CreateDate") %>
                        </div>
                        <div style="float: left; width: 400px; padding: 0 20px 20px 0;">
                            <asp:LinkButton runat="server" ID="lCompanyMessageTeaser" Text='<%# Eval("Title") %>' CommandName="EditListItem" CommandArgument='<%# Eval("SiteContentId") %>' />
                        </div>
                        <div class="adminButton">
                            <asp:LinkButton runat="server" ID="btnDeleteListItem" CommandName="DeleteListItem" CommandArgument='<%# Eval("SiteContentId") %>' ToolTip="Удалить" CssClass="buttonDelete" OnClientClick="return confirm('Подтвердите удаление')" />
                        </div>
                        <div class="adminButton">
                            <asp:LinkButton runat="server" ID="btnEditListItem" CommandName="EditListItem" CommandArgument='<%# Eval("SiteContentId") %>' ToolTip="Правка" CssClass="buttonEdit" />
                        </div>
                    </div>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Literal runat="server" ID="lCloseDiv" Text="</div>" />
                </FooterTemplate>
            </asp:Repeater>
        </asp:View>
    </asp:MultiView>
</asp:Content>
